<template>
  <view class="searchPeopleList">
    <SearchPeopleItem
      v-for="(item, index) in userList"
      :key="index"
      :userDetail="item"
      :showOperator="false"
    />
    <EmptyBox v-if="!userList.length" />
  </view>
</template>

<script>
import SearchPeopleItem from "../../../components/search/SearchPeopleItem.vue";
import EmptyBox from "../../../components/public/EmptyBox.vue";
import { mapState } from "vuex";
export default {
  name: "SearchPeopleList",
  components: {
    SearchPeopleItem,
    EmptyBox,
  },

  data() {
    return {
      userList: [],
    };
  },

  computed: {
    ...mapState("m_search", ["searchUserList"]),
    ...mapState(["userInfo"]),
  },
  watch: {
    searchUserList(newValue) {
      for (let i = 0; i < newValue.length; i++) {
        setTimeout(() => {
          this.userList.push(newValue[i]);
        }, 100 * i);
      }
    },
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.searchPeopleList {
  background-color: #fff;
}
</style>
